from Mouth_examofzhuan5.Base.Base import Base
from time import sleep
from selenium.webdriver.common.by import By

class Page_two(Base):
    # 搜索框  cssselector属性
    search=(By.CSS_SELECTOR,'.search-form')


    # 点击搜索按钮
    search_btn=(By.CLASS_NAME,'search-btn')

    # 商品图片
    sp_pict=(By.XPATH,'/html/body/div[6]/div/div[2]/div[5]/ul/li[1]/div[2]/div[1]/a/img')

    # 数量+1
    add=(By.XPATH,'/html/body/div[5]/div[2]/div[2]/div[6]/div[5]/div[2]/div[1]/a[1]')

    # 点击加入购物车
    add_car=(By.XPATH,'//*[@id="addToCartForDetail"]')




    def addcar(self):
        sleep(2)
        self.send_keys(self.search,'赖茅')
        self.click(self.search_btn)
        self.click(self.sp_pict)
        self.new_window()
        self.click(self.add_car)
        self.click(self.add_car)


